ng911ok.lib.accessor module#
- exception InconsistentParityError#
Bases:
Exception
- exception InvertedAddressRangeError(from_addr: int, to_addr: int)#
Bases:
Exception
- exception NGUIDFormatError(invalid_nguid: str, problem: Literal['ERROR:DOMAIN:INVALID_VALUE', 'ERROR:GENERAL:INVALID_VALUE', 'ERROR:GENERAL:MANDATORY_IS_NULL', 'ERROR:GENERAL:MANDATORY_IS_BLANK', 'ERROR:GENERAL:NOT_UPPERCASE', 'ERROR:GENERAL:UNIQUENESS', 'WARNING:GENERAL:LEADING_TRAILING_SPACE', 'ERROR:NGUID:FORMAT', 'ERROR:NGUID:V2_FORMAT', 'ERROR:NGUID:AGENCY', 'ERROR:NGUID:LAYER', 'ERROR:NGUID:DUPLICATE', 'ERROR:ADDRESS:DUPLICATE', 'ERROR:ADDRESS_RANGE:OVERLAP', 'ERROR:ADDRESS_RANGE:DECREASING', 'ERROR:ROAD_ESN:DEVIATION', 'ERROR:ROAD_ESN:CROSSING', 'ERROR:ROAD_ESN:OUT_OF_BOUNDS', 'ERROR:PARITY:EXPECTED_ZERO', 'ERROR:PARITY:EXPECTED_NONZERO', 'ERROR:PARITY:MISMATCH', 'ERROR:PARITY:INVALID', 'ERROR:PARITY:NULL', 'ERROR:LEGACY:MISMATCH', 'ERROR:GEOCODE:UNKNOWN_MATCH', 'ERROR:GEOCODE:WRONG_SIDE', 'ERROR:GEOCODE:BOTH_SIDES', 'ERROR:GEOCODE:WRONG_COMMUNITY', 'ERROR:GEOCODE:OUT_OF_RANGE', 'ERROR:GEOCODE:NAME_MISMATCH', 'ERROR:CONSISTENCY:ADDRESS_ESN', 'ERROR:CONSISTENCY:ROAD_ESN', 'ERROR:CONSISTENCY:COMMUNITY', 'WARNING:CONSISTENCY:ROAD_LEVEL', 'WARNING:CONSISTENCY:ROAD_ESN', 'ERROR:GEOMETRY:TOPOLOGY', 'WARNING:GEOMETRY:CUTBACK', 'WARNING:GEOMETRY:SHORT_SEGMENT', 'NOTICE:CONSISTENCY:ROAD_ESN'], details: str | None = None, piece: Literal['LAYER', 'LOCAL_ID', 'AGENCY_ID'] | None = None)#
Bases:
ValueError- _raw_details: str | None#
- details: str#
- invalid_nguid: str#
- problem: Literal['ERROR:DOMAIN:INVALID_VALUE', 'ERROR:GENERAL:INVALID_VALUE', 'ERROR:GENERAL:MANDATORY_IS_NULL', 'ERROR:GENERAL:MANDATORY_IS_BLANK', 'ERROR:GENERAL:NOT_UPPERCASE', 'ERROR:GENERAL:UNIQUENESS', 'WARNING:GENERAL:LEADING_TRAILING_SPACE', 'ERROR:NGUID:FORMAT', 'ERROR:NGUID:V2_FORMAT', 'ERROR:NGUID:AGENCY', 'ERROR:NGUID:LAYER', 'ERROR:NGUID:DUPLICATE', 'ERROR:ADDRESS:DUPLICATE', 'ERROR:ADDRESS_RANGE:OVERLAP', 'ERROR:ADDRESS_RANGE:DECREASING', 'ERROR:ROAD_ESN:DEVIATION', 'ERROR:ROAD_ESN:CROSSING', 'ERROR:ROAD_ESN:OUT_OF_BOUNDS', 'ERROR:PARITY:EXPECTED_ZERO', 'ERROR:PARITY:EXPECTED_NONZERO', 'ERROR:PARITY:MISMATCH', 'ERROR:PARITY:INVALID', 'ERROR:PARITY:NULL', 'ERROR:LEGACY:MISMATCH', 'ERROR:GEOCODE:UNKNOWN_MATCH', 'ERROR:GEOCODE:WRONG_SIDE', 'ERROR:GEOCODE:BOTH_SIDES', 'ERROR:GEOCODE:WRONG_COMMUNITY', 'ERROR:GEOCODE:OUT_OF_RANGE', 'ERROR:GEOCODE:NAME_MISMATCH', 'ERROR:CONSISTENCY:ADDRESS_ESN', 'ERROR:CONSISTENCY:ROAD_ESN', 'ERROR:CONSISTENCY:COMMUNITY', 'WARNING:CONSISTENCY:ROAD_LEVEL', 'WARNING:CONSISTENCY:ROAD_ESN', 'ERROR:GEOMETRY:TOPOLOGY', 'WARNING:GEOMETRY:CUTBACK', 'WARNING:GEOMETRY:SHORT_SEGMENT', 'NOTICE:CONSISTENCY:ROAD_ESN']#
- property validation_message: str#
Returns a single-line string suitable for writing to a validation error table.
- class AddressRange(from_addr: int, to_addr: int, parity: Parity, suppress_errors: bool = False)#
Bases:
object- classmethod auto_fix_directionality(from_addr: int, to_addr: int, parity: Parity, suppress_errors: bool = False) Self#
- classmethod zero() Self#
- _validate() bool#
- overlaps(other: Self) bool#
- to_array() ndarray#
- to_set() set[int]#
Returns a
setcontaining all integers of appropriate parity betweenfrom_addrandto_addr, inclusive. If parity is zero, an empty set is returned.
- property details: str#
Returns a more detailed informational string than
__str__().
- property directionality: Directionality#
- property directionality_is_valid: bool#
Returns
Trueif the instance’sdirectionalityisINCREASING,SINGLE, orZERO. Otherwise, returnsFalse.
- from_addr: int#
- property is_valid: bool#
- suppress_errors: bool#
- to_addr: int#
- class Directionality(value)#
Bases:
StrEnumRepresents the directionality of an address range.
- _generate_next_value_(start, count, last_values)#
Return the lower-cased version of the member name.
- DECREASING = 'Decreasing'#
Represents an address range where the to-address is lower than the from-address.
- INCREASING = 'Increasing'#
Represents an address range where the to-address is higher than the from-address.
- SINGLE = 'Single'#
Represents an address range where the from-address and to-address are equal and non-zero.
- ZERO = 'Zero'#
Represents an address range where the parity is
Parity.ZERO.
- class NG911Accessor(pandas_obj: DataFrame)#
Bases:
object- address_range_left(suppress_errors=False, auto_fix_directionality=False) Series#
- address_range_right(suppress_errors=False, auto_fix_directionality=False) Series#
- property address_parity: Series#
- property directionality_left: Series#
- property directionality_right: Series#
- property parity_left: Series#
- property parity_right: Series#
- class NG911SeriesAccessor(pandas_obj: Series)#
Bases:
object- property field: NG911Field#
- class NGUID(layer: str, local_id, agency_id: str)#
Bases:
object- classmethod _diagnose_v3(string: str) NGUIDFormatError#
Method to attempt to diagnose the specific format violation of (what should be) a v3 NGUID.
- Parameters:
string (str) – The v3 NGUID string in violation
- Returns:
Exception to analyze and/or raise
- Return type:
- classmethod from_string(string: str) Self#
- classmethod from_v2_string(string: str) Self#
- classmethod validate_string(string: str) NGUIDFormatError | None#
Validates the format of an NGUID string.
- Parameters:
string (str) – NGUID to validate
- Returns:
Noneif the NGUID is valid, otherwise, an instance ofNGUIDFormatError- Return type:
NGUIDFormatError | None
- AGENCYID_PATTERN: ClassVar[Pattern] = re.compile('[A-Za-z\\d][A-Za-z\\d-]*(?:\\.[A-Za-z\\d][A-Za-z\\d-]*)+')#
- LAYER_PATTERN: ClassVar[Pattern] = re.compile('[A-Za-z_]\\w*')#
- LOCALID_PATTERN: ClassVar[Pattern] = re.compile('[\\w\\(\\)\\[\\]\\{\\}-]+')#
- NGUID_PATTERN: ClassVar[Pattern] = re.compile('urn:emergency:uid:gis:([A-Za-z_]\\w*):([\\w\\(\\)\\[\\]\\{\\}-]+):([A-Za-z\\d][A-Za-z\\d-]*(?:\\.[A-Za-z\\d][A-Za-z\\d-]*)+)')#
- V2_LOCALID_PATTERN: ClassVar[Pattern] = re.compile('[\\x20-\\x39\\x3b-\\x3f\\x41-\\x7e]+')#
- V2_NGUID_PATTERN: ClassVar[Pattern] = re.compile('^([A-Za-z_]\\w*)_([\\x20-\\x39\\x3b-\\x3f\\x41-\\x7e]+)@([A-Za-z\\d][A-Za-z\\d-]*(?:\\.[A-Za-z\\d][A-Za-z\\d-]*)+)$')#
- agency_id: str#
- property feature_class: NG911FeatureClass#
- layer: str#
- local_id: str#
- property nguid_field: NG911Field#